package com.scpii.universal.dispatch;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.scpii.universal.util.DispathConfigUtil;

public class DispathConfigListener implements ServletContextListener {

	private static final Logger logger = LoggerFactory
			.getLogger(DispathConfigListener.class);

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
	}

	@Override
	public void contextInitialized(ServletContextEvent event) {
		try {

			/**
			 * 加载IOS图片大小
			 */

			Const.SIZE_MAP.put("bg_list.png", "640#128");
			Const.SIZE_MAP.put("bg_tabbar.png", "640#98");
			Const.SIZE_MAP.put("bg_titlebar_sub.png", "640#88");
			Const.SIZE_MAP.put("bg_titlebar.png", "640#88");
			Const.SIZE_MAP.put("icon.png", "114#114");
			Const.SIZE_MAP.put("page_1.png", "60#60");
			Const.SIZE_MAP.put("page_2.png", "60#60");
			Const.SIZE_MAP.put("page_3.png", "60#60");
			Const.SIZE_MAP.put("page_4.png", "60#60");
			Const.SIZE_MAP.put("page_5.png", "60#60");
			Const.SIZE_MAP.put("page_6.png", "60#60");
			Const.SIZE_MAP.put("page_7.png", "60#60");
			Const.SIZE_MAP.put("page_8.png", "60#60");

			/**
			 * 修改内容：将原来的ini配置文件替换为Properties文件 修改时间：2012-12-18 修改人：左柳波
			 */
			logger.info("加载配制文件");
			DispathConfigUtil.load("classpath:dispatch.properties");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}